/** 用户相关 **/

import request from "../request";

let userApi = 'loginserviceapi';

/**
 * 获取验证码图片地址
 * @returns {AxiosPromise}
 */
export function captcha(params) {
    return request({
        method: "get",
        url: userApi+"/oauth/captcha",
        params: params
    });
};

/**
 * 登录
 * @returns {AxiosPromise}
 */
export function login(data) {
    return request({
        method: "post",
        url: userApi+"/oauth/login",
        data
    });
};


/**
 * 登录
 * @returns {AxiosPromise}
 */
export function register(data) {
    return request({
        method: "post",
        url: userApi+"/oauth/register",
        data
    });
};

/**
 * 获取当前用户的目录
 * @returns {AxiosPromise}
 */
export function getMenusByAdminId() {
    return request({
        method: "get",
        url: userApi+"/main/getMenusByAdminId",
    });
};
/**
 * 上传文件
 * @returns {AxiosPromise}
 */
export function upload(data,params) {
    return request({
        method: "post",
        url: userApi+"/main/upload",
        headers: { 'Content-Type': 'multipart/form-data' }, //多文件上传这一句必须加
        data,
        params:params
    });
};